package com.swak.frame.ratelimit.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.context.annotation.Import;

import com.swak.frame.ratelimit.LimitType;
import com.swak.frame.ratelimit.constants.RateLimitConstant;
import com.swak.frame.ratelimit.spring.configuration.RateLimitConfigurationImportSelector;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(RateLimitConfigurationImportSelector.class)
public @interface EnableRateLimiting {


	/**
	 * 排序 {@link  @Ordered}
	 * @return
	 */
	int order() default RateLimitConstant.ORDER_PRECEDENCE;

	/**
	 * 限流类型 {@link com.swak.frame.ratelimit.LimitType}
	 * 
	 * @return
	 */
	LimitType limitType() default LimitType.LOCAL_TOKEN;

	/**
	 * 是否支持动态限流
	 * 
	 * @return
	 */
	boolean dynamic() default false;
}
